package com.meichis.yndms.room.converter;

import androidx.room.TypeConverter;

import com.google.gson.Gson;
import com.meichis.yndms.model.*;

public class EntityConverter {

    //InspectTemplate
    @TypeConverter
    public static UserInfo strProduct(String json) {
        return new Gson().fromJson(json, UserInfo.class);
    }

    @TypeConverter
    public static String prodect2Str(UserInfo entity) {
        return new Gson().toJson(entity);
    }

    //VisitWorkItem_JD
    @TypeConverter
    public static VisitWorkItem_JD strJD(String json) {
        return new Gson().fromJson(json, VisitWorkItem_JD.class);
    }

    @TypeConverter
    public static String aM2Str(VisitWorkItem_JD entity) {
        return new Gson().toJson(entity);
    }

    //VisitWorkItem_InventoryCheck
    @TypeConverter
    public static VisitWorkItem_InventoryCheck strIC(String json) {
        return new Gson().fromJson(json, VisitWorkItem_InventoryCheck.class);
    }

    @TypeConverter
    public static String iC2Str(VisitWorkItem_InventoryCheck entity) {
        return new Gson().toJson(entity);
    }

    //VisitWorkItem_IssueLog
    @TypeConverter
    public static VisitWorkItem_IssueLog strIL(String json) {
        return new Gson().fromJson(json, VisitWorkItem_IssueLog.class);
    }

    @TypeConverter
    public static String iL2Str(VisitWorkItem_IssueLog entity) {
        return new Gson().toJson(entity);
    }

    //InspectTemplate
    @TypeConverter
    public static InspectTemplate strIT(String json) {
        return new Gson().fromJson(json, InspectTemplate.class);
    }

    @TypeConverter
    public static String iT2Str(InspectTemplate entity) {
        return new Gson().toJson(entity);
    }

    //ClientInfo
    @TypeConverter
    public static ClientInfo strci(String json) {
        return new Gson().fromJson(json, ClientInfo.class);
    }

    @TypeConverter
    public static String ci2Str(ClientInfo entity) {
        return new Gson().toJson(entity);
    }

}
